$OpenBSD: patch-kdecore_util_kshareddatacache_cpp,v 1.2 2014/07/11 11:13:10 zhuk Exp $
More correct implementation of random() & Co., using arc4random().
--- kdecore/util/kshareddatacache.cpp.orig	Sun Jun  8 15:41:32 2014
+++ kdecore/util/kshareddatacache.cpp	Fri Jul 11 09:12:19 2014
@@ -449,19 +449,13 @@ struct SharedMemory
             return false;
         }
 
-        bool isProcessShared = false;
         QSharedPointer<KSDCLock> tempLock(createLockFromId(shmLock.type, shmLock));
 
-        if (!tempLock->initialize(isProcessShared)) {
+        if (!tempLock->initialize()) {
             kError(ksdcArea()) << "Unable to initialize the lock for the cache!";
             return false;
         }
 
-        if (!isProcessShared) {
-            kWarning(ksdcArea()) << "Cache initialized, but does not support being"
-                          << "shared across processes.";
-        }
-
         // These must be updated to make some of our auxiliary functions
         // work right since their values will be based on the cache size.
         cacheSize = _cacheSize;
@@ -1180,9 +1174,8 @@ class KSharedDataCache::Private
 
         m_expectedType = shm->shmLock.type;
         m_lock = QSharedPointer<KSDCLock>(createLockFromId(m_expectedType, shm->shmLock));
-        bool isProcessSharingSupported = false;
 
-        if (!m_lock->initialize(isProcessSharingSupported)) {
+        if (!m_lock->initialize()) {
             kError(ksdcArea()) << "Unable to setup shared cache lock, although it worked when created.";
             detachFromSharedMemory();
         }
@@ -1474,7 +1467,7 @@ bool KSharedDataCache::insert(const QString &key, cons
         }
         else if (loadFactor > startCullPoint) {
             const int tripWireValue = RAND_MAX * (loadFactor - startCullPoint) / (mustCullPoint - startCullPoint);
-            if (KRandom::random() >= tripWireValue) {
+            if ((int)KRandom::uniform(RAND_MAX) >= tripWireValue) {
                 cullCollisions = true;
             }
         }
